﻿using MediatR;
using T_Rbac.Read.APi.Application.Command.Jobs;
using T_Rbac_Demain;
using T_Rbac_Rep.Interface;

namespace T_Rbac.Read.APi.Application.Handlers.JobsHandlers
{
    public class JobSearchByIdHandlers : IRequestHandler<JobSearchByIdCommand, Job>
    {
        private readonly IjobRep ijobRep;

        public JobSearchByIdHandlers(IjobRep ijobRep)
        {
            this.ijobRep = ijobRep;
        }

        public async Task<Job> Handle(JobSearchByIdCommand request, CancellationToken cancellationToken)
        {
            var list = await ijobRep.GetAloneByid(request.id);
            return await Task.FromResult(list);
        }
    }
}
